﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Common.DataBase.Model {
  public class TableInfo {

    private string _tableName = string.Empty;

    private Dictionary<string, ColumnInfo> _columns = new Dictionary<string, ColumnInfo>();

    public string TableName {
      get {
        return _tableName;
      }

      set {
        _tableName = value;
      }
    }

    public Dictionary<string, ColumnInfo> Columns {
      get {
        return _columns;
      }

      set {
        _columns = value;
      }
    }
  }

  public class ColumnInfo {

    
    private string _name = string.Empty;
    private string _type = string.Empty;
    private bool _isPrimary = false;
    private Int64 _length = -1;
    private string _defaultValue = string.Empty;

    /// <summary>
    /// 字段名
    /// </summary>
    public string Name {
      get {
        return _name;
      }

      set {
        _name = value;
      }
    }


    /// <summary>
    /// 字段类型
    /// </summary>
    public string Type {
      get {
        return _type;
      }

      set {
        _type = value;
      }
    }

    /// <summary>
    /// 是否主键
    /// </summary>
    public bool IsPrimary {
      get {
        return _isPrimary;
      }

      set {
        _isPrimary = value;
      }
    }


    /// <summary>
    /// 字段长度，-1 表示长度无限制
    /// </summary>
    public long Length {
      get {
        return _length;
      }

      set {
        _length = value;
      }
    }

    public string DefaultValue {
      get {
        return _defaultValue;
      }

      set {
        _defaultValue = value;
      }
    }
  }


}
